package edu.uwm.capstone.util;

import java.lang.reflect.Array;

/**
 * @author Palaniappan
 * @version 1.0
 * Contains a method called {@link resizeArray()} ,used to resize the array to new value.
 * */
public class ArrayUtil
{
  /**
 * @param src Array class to be resized
 * @param paramInt size to increase
 * @return resized array
 */
public static Object resizeArray(Object src, int paramInt)
  {
    int i = Array.getLength(src);
    Object dst = Array.newInstance(src.getClass().getComponentType(), paramInt);
    int length = Math.min(i, paramInt);
    if (length > 0)
      System.arraycopy(src, 0, dst, 0, length);//Object src, int srcPos, Object dst, int dstPos, int length
    return dst;
  }
}